package com.hpf.community.pojo;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 用户表实体类  与数据库一一对应,请勿轻易修改
 * </p>
 *
 * @author huangpengfei
 * @version 2020年04月04日---22:57:14
 * @description
 */
@Data
public class User extends Model<User> {

    private static final long serialVersionUID = 1L;

    public static final String ID = "ID";

    public static final String NAME = "NAME";

    public static final String PASS = "PASS";

    public static final String BIRTH = "BIRTH";

    public static final String SEX = "SEX";

    public static final String NATIVIES = "NATIVIES";

    public static final String HOBBY = "HOBBY";

    public static final String CLASS_ID = "CLASS_ID";

    public static final String COM_ID = "COM_ID";

    public static final String EMAIL = "EMAIL";

    public static final String TELEPHONE = "TELEPHONE";

    public static final String HEAD_IMG = "HEAD_IMG";

    public static final String STATUS = "STATUS";

    public static final String CREATE_DATETIME = "CREATE_DATETIME";

    public static final String ROLE = "ROLE";

    public static final String CLASS_NAME = "CLASS_NAME";

    public static final String COM_NAME = "COM_NAME";

    public static final String IS_DELETE = "IS_DELETE";

    public static final String REJECT_REASON = "REJECT_REASON";


    @TableId(value = "ID")
    private String id;

    @TableField("NAME")
    private String name;

    @TableField("IS_DELETE")
    private String isDelete;

    @TableField("PASS")
    private String pass;

    @TableField("BIRTH")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birth;

    @TableField("SEX")
    private String sex;

    @TableField("NATIVIES")
    private String nativies;

    @TableField("HOBBY")
    private String hobby;

    @TableField("CLASS_ID")
    private String classId;

    @TableField("CLASS_NAME")
    private String className;

    @TableField("COM_NAME")
    private String comName;

    /**
     * 密码加密的盐值
     * @param:
     * @return:
     * @author: HPF
     * @date: 2020/4/17 19:48
     */
    @TableField("SALT")
    private String salt;

    @TableField("COM_ID")
    private String comId;

    @TableField("EMAIL")
    private String email;

    @TableField("TELEPHONE")
    private Double telephone;

    @TableField("HEAD_IMG")
    private String headImg;

    @TableField("REJECT_REASON")
    private String rejectReason;

    @TableField("STATUS")
    private String status;

    @TableField("CREATE_USERID")
    private String createUserId;

    @TableField("CREATE_DATETIME")
    private Date createDatetime;

    @TableField("MODIFY_USERID")
    private String modifyUserId;

    @TableField("MODIFY_DATETIME")
    private Date modifyDatetime;

    @TableField("ROLE")
    private String role;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    /**
     * 加密后的密码
     * @param: []
     * @return: java.lang.String
     * @author: HPF
     * @date: 2020/4/17 19:49
     */
    public String getCredentialsSalt() {
        return name + salt + salt;
    }

}
